package com.notepad.navbar;

import com.coobee.fx.support.FXMLView;
import com.coobee.fx.support.Popup;
import com.coobee.fx.support.ui.UI.Locations;
import com.coobee.fx.support.ui.UIAction;

import javafx.geometry.HPos;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;

/**
 * MorePopup.
 * 
 * @author DELL
 */
@FXMLView(title = "更多", value = "MorePopup.fxml", css = "MorePopup.css")
public class MorePopup extends Popup {

	private UIAction settingsBtn;
	private UIAction helpBtn;
	private UIAction aboutBtn;

	public MorePopup() {
		this.aboutBtn = new UIAction().setText("关于");
		this.helpBtn = new UIAction().setText("帮助");
		this.settingsBtn = new UIAction().setText("设置");
	}

	@Override
	public void initializeParts() {
		super.initializeParts();
		this.animatedProperty().set(true);
		this.locationProperty().set(Locations.LEFT_BOTTOM);
		this.addChild(aboutBtn);
		this.addChild(helpBtn);
		this.addChild(settingsBtn);
		this.initBtn(aboutBtn);
		this.initBtn(helpBtn);
		this.initBtn(settingsBtn);

		GridPane.setConstraints(this.aboutBtn, 0, 0);
		GridPane.setConstraints(this.helpBtn, 0, 1);
		GridPane.setConstraints(this.settingsBtn, 0, 2);
	}

	private void initBtn(UIAction btn) {
		btn.setPrefHeight(30);
		GridPane.setHgrow(btn, Priority.ALWAYS);
		GridPane.setHalignment(btn, HPos.CENTER);
	}

	@Override
	public void layoutParts() {
		super.layoutParts();
	}

}
